package com.kfm.controller;

import com.kfm.entity.Account;
import com.kfm.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private AccountService service;

    @PostMapping("/save")
    public String save(@Validated Account account){
        System.out.println(account);
        service.save(account);

        return "保存成功";
    }


    @GetMapping("/list")
    public List<Account> all(){
        System.out.println("all");
        return new ArrayList<>();
    }

}
